<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <!-- 引入样式文件和动态控制 -->
    <script src="b_js/jquery-3.2.1.min.js"></script>
    <script src="b_js/bootstrap.min.js"></script>
    <!--主要样式控制-->
    <link href="b_css/bootstrap.min.css" rel="stylesheet">
    <link href="b_css/bootstrap.css" rel="stylesheet">
    <link href="b_css/main.css" rel="stylesheet">
    <title>bootstrap后台模板设计</title>

</head>
<body>
<!--顶部导航栏部分-->
<nav class="navbar navbar-inverse">
    <div class="container-fluid">
        <div class="navbar-header" style="text-align: center;">
            <a class="navbar-brand" title="logoTitle" href="#">logo  高校点餐</a>
       </div>
       <div class="collapse navbar-collapse">
           <ul class="nav navbar-nav navbar-right">
               <li role="presentation">
                   <a href="#">当前用户：<span class="badge">管理员</span></a>
               </li>
               <li>
                   <a onclick="lot()" href="##">
                        退出登录</a>
                </li>
            </ul>
       </div>
    </div>
</nav>
<!-- <nav class="nav_c">
    <div class="nav_l">
        <a class="navbar-brand" title="logoTitle" href="#">logo</a>
    </div>
    <div class="nav_r">
         <div class="out">
             <div class="name">当前用户：<span>柒晓白</span></a></div>
             <div class="out_class"><span class=""></span>退出登录</a></div>
         </div>
    </div>
</nav> -->

<!-- 中间主体内容部分 -->
<div class="pageContainer">
     <!-- 左侧导航栏 -->
     <div class="pageSidebar">
         <ul class="nav nav-stacked nav-pills">
             <li role="presentation">
                 <a href="b_page/welcome.html" target="mainFrame" >首页</a>
             </li>
             <li role="presentation">
                 <a href="b_page/my_information.html" target="mainFrame" >我的信息</a>
             </li>
             <li role="presentation" class="user">
                 <a href="b_page/user.html" target="mainFrame" >用户管理</a>
             </li>
             <li role="presentation" class="touristRoute">
                 <a href="b_page/diningTable.html" target="mainFrame">餐台管理</a>
             </li>
             <li role="presentation" class="touristRoute">
                 <a href="b_page/touristRoute.html" target="mainFrame">菜品管理</a>
             </li>
             <!-- <li role="presentation">
                 <a href="b_page/nav3.html" target="mainFrame">教师管理</a>
             </li> -->
             <!-- 开始 -->
             <!-- <li class="dropdown">
                 <a class="dropdown-toggle" data-toggle="dropdown" href="nav4.html" target="mainFrame">
                     个人设置<span class="caret"></span>
                 </a>
                 <ul class="dropdown-menu">
                     <li>
                         <a href="b_page/nav1.html" target="mainFrame">修改密码</a>
                     </li>
                     <li>
                         <a href="b_page/touristRoute.html" target="mainFrame">退出系统</a>
                     </li>
                     <li>
                         <a href="b_page/nav3.html" target="mainFrame">查看个人信息</a>
                     </li>
                 </ul>
             </li> -->
             <!-- 结束 -->
             <li role="presentation">
                 <a href="b_page/nav4.html" target="mainFrame">订单管理</a>
             </li>
             <li role="presentation">
                 <a href="b_page/nav3.html" target="mainFrame">优惠券列表</a>
             </li>
         </ul>
     </div>

      <!-- 左侧导航和正文内容的分隔线 -->
     <div class="splitter"></div>
     <!-- 正文内容部分 -->
     <div class="pageContent">
       <iframe src="b_page/welcome.html" id="mainFrame" name="mainFrame" frameborder="0" width="100%"  height="100%" frameBorder="0"></iframe>
     </div>

    </div>
    <!-- 底部页脚部分 -->
    <div class="footer">
        <p class="text-center">
            2020 &copy; 管理员.
        </p>
    </div>

    <script src="b_js/utils.js"></script>
    <script src="b_js/toastr.min.js"></script>
    <script type="text/javascript">
    // 获取用户信息
    getUserList();
    function getUserList() {
        $.ajax({
            type:"get",
            url: upUrl + "/session",
            data: {},
            success:function(data){
                console.log(data)
                if (data.code == 200) {
                    console.log(data)
                    $(".badge").text(data.result.name);
                    if (data.result.usetype == '1') {
                        $(".user").show();
                        $(".touristRoute").show();
                    }
                    if (data.result.usetype == '0') {
                        $(".user").hide();
                        $(".touristRoute").hide();
                    }
                } else {
                    toastr.error(data.message);
                }
            },
        })

    }
    $(".nav li").click(function() {
            $(".active").removeClass('active');
            $(this).addClass("active");
        });
        // if (window.sessionStorage.getItem('admin') == null) {
        //     $(".admin").hide();
        //     $(".login1").show();
        // } else {
        //     $(".login1").hide(); 
        // }
        function lot () {
            $.ajax({
                type:"post",
                url: upUrl + "/exit",
                data: {},
                dataType: "json",
                success:function(data){
                    if (data.code == 200) {
                        toastr.success("退出成功!");
                        // 重新刷新表格数据
                        // ./login.html
                        location.href ="./login.html"
                        window.sessionStorage.clear()
                    } else {
                        toastr.error(data.message);
                    }
                }
            })
        }
    </script>
</body>
</html>